<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>超现实登录界面</title>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/animejs/3.2.1/anime.min.js"></script>
    <style>
        :root {
            --primary-hue: 260;
            --secondary-hue: 160;
            --accent-hue: 0;
            --glass: rgba(255, 255, 255, 0.15);
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            min-height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            overflow: hidden;
            background: #000;
            font-family: 'SF Pro Display', sans-serif;
        }

        #canvas3d {
            position: fixed;
            top: 0;
            left: 0;
            z-index: 0;
        }

        .login-container {
            position: relative;
            width: 400px;
            background: var(--glass);
            backdrop-filter: blur(25px);
            border-radius: 20px;
            padding: 40px;
            box-shadow: 0 0 50px rgba(0, 0, 0, 0.3);
            border: 1px solid rgba(255,255,255,0.1);
            transform: perspective(1000px);
            z-index: 1;
        }

        .login-header {
            text-align: center;
            margin-bottom: 40px;
            position: relative;
        }

        .hologram-title {
            font-size: 2.5em;
            color: #fff;
            text-shadow: 0 0 15px hsl(var(--primary-hue), 100%, 70%);
            animation: hologram 3s infinite;
        }

        @keyframes hologram {
            0%, 100% { filter: hue-rotate(0deg); opacity: 1; }
            50% { filter: hue-rotate(90deg); opacity: 0.8; }
        }

        .input-group {
            margin-bottom: 30px;
            position: relative;
        }

        .cyber-input {
            width: 100%;
            padding: 18px;
            background: rgba(0,0,0,0.3);
            border: 2px solid hsl(var(--primary-hue), 100%, 50%);
            border-radius: 8px;
            color: #fff;
            font-size: 16px;
            transition: all 0.3s;
        }

        .cyber-input:focus {
            outline: none;
            box-shadow: 0 0 20px hsl(var(--primary-hue), 100%, 50%);
            background: rgba(0,0,0,0.5);
        }

        .input-label {
            position: absolute;
            left: 15px;
            top: 50%;
            transform: translateY(-50%);
            color: #888;
            pointer-events: none;
            transition: 0.3s;
        }

        .cyber-input:focus + .input-label,
        .cyber-input:not(:placeholder-shown) + .input-label {
            top: -10px;
            left: 5px;
            font-size: 12px;
            color: hsl(var(--primary-hue), 100%, 70%);
            text-shadow: 0 0 10px currentColor;
        }

        .quantum-button {
            width: 100%;
            padding: 18px;
            background: linear-gradient(45deg,
            hsl(var(--primary-hue), 100%, 50%),
            hsl(var(--secondary-hue), 100%, 50%));
            border: none;
            border-radius: 8px;
            color: #fff;
            font-size: 16px;
            cursor: pointer;
            position: relative;
            overflow: hidden;
            transition: 0.3s;
        }

        .quantum-button:hover {
            transform: scale(1.05);
            box-shadow: 0 0 30px hsl(var(--primary-hue), 100%, 50%);
        }

        .quantum-button::after {
            content: '';
            position: absolute;
            top: -50%;
            left: -50%;
            width: 200%;
            height: 200%;
            background: linear-gradient(45deg,
            transparent 25%,
            rgba(255,255,255,0.1) 50%,
            transparent 75%);
            animation: shine 3s infinite;
        }

        @keyframes shine {
            100% { transform: rotate(360deg); }
        }

        .particle-error {
            position: absolute;
            pointer-events: none;
            z-index: 100;
        }
    </style>
</head>
<body>
<canvas id="canvas3d"></canvas>

<div class="login-container">
    <div class="login-header">
        <h1 class="hologram-title">量子登录</h1>
    </div>

    <form id="cyberForm">
        <div class="input-group">
            <input type="text" class="cyber-input" id="username"
                   placeholder=" " required>
            <label class="input-label">用户名 / 邮箱</label>
        </div>

        <div class="input-group">
            <input type="password" class="cyber-input" id="password"
                   placeholder=" " required>
            <label class="input-label">量子密码</label>
        </div>

        <button type="submit" class="quantum-button">身份验证</button>
    </form>
</div>

<script>
    // Three.js 动态背景
    const scene = new THREE.Scene();
    const camera = new THREE.PerspectiveCamera(75, window.innerWidth/window.innerHeight, 0.1, 1000);
    const renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true });
    renderer.setSize(window.innerWidth, window.innerHeight);
    document.getElementById('canvas3d').appendChild(renderer.domElement);

    // 创建动态粒子场
    const particles = new THREE.BufferGeometry();
    const particleCount = 5000;
    const posArray = new Float32Array(particleCount * 3);

    for(let i=0; i<particleCount*3; i++) {
        posArray[i] = (Math.random() - 0.5) * 5;
    }

    particles.setAttribute('position', new THREE.BufferAttribute(posArray, 3));
    const material = new THREE.PointsMaterial({
        size: 0.005,
        color: new THREE.Color(`hsl(${Math.random()*360}, 100%, 70%)`),
        transparent: true,
        blending: THREE.AdditiveBlending
    });

    const particleMesh = new THREE.Points(particles, material);
    scene.add(particleMesh);

    camera.position.z = 2;

    // 背景动画
    function animate() {
        requestAnimationFrame(animate);
        particleMesh.rotation.x += 0.001;
        particleMesh.rotation.y += 0.002;
        renderer.render(scene, camera);
    }
    animate();

    // 高级表单交互
    document.querySelectorAll('.cyber-input').forEach(input => {
        input.addEventListener('focus', e => {
            anime({
                targets: e.target,
                borderColor: `hsl(${Math.random()*360}, 100%, 50%)`,
                duration: 1000,
                easing: 'easeOutExpo'
            });
        });
    });

    // 量子按钮效果
    document.querySelector('.quantum-button').addEventListener('mousemove', e => {
        const rect = e.target.getBoundingClientRect();
        const x = e.clientX - rect.left;
        const y = e.clientY - rect.top;
        e.target.style.setProperty('--primary-hue', x/rect.width * 360);
        e.target.style.setProperty('--secondary-hue', y/rect.height * 360);
    });

    // 粒子错误效果
    function createErrorParticles(x, y) {
        const particles = [];
        for(let i=0; i<50; i++) {
            const p = document.createElement('div');
            p.className = 'particle-error';
            p.style.left = x + 'px';
            p.style.top = y + 'px';
            p.style.color = `hsl(${Math.random()*360}, 100%, 50%)`;
            p.innerHTML = '✖';
            document.body.appendChild(p);

            anime({
                targets: p,
                translateX: Math.random() * 200 - 100,
                translateY: Math.random() * 200 - 100,
                opacity: [1, 0],
                scale: [1, 3],
                duration: 1000,
                easing: 'easeOutExpo',
                complete: () => p.remove()
            });
            particles.push(p);
        }
    }

    // 表单验证
    document.getElementById('cyberForm').onsubmit = e => {
        e.preventDefault();
        const username = document.getElementById('username');
        const password = document.getElementById('password');

        if(username.value.length < 4) {
            const rect = username.getBoundingClientRect();
            createErrorParticles(rect.left + rect.width/2, rect.top + rect.height/2);
            anime({
                targets: username,
                translateX: [10, -10, 0],
                duration: 100,
                easing: 'easeInOutQuad'
            });
        }

        if(password.value.length < 8) {
            const rect = password.getBoundingClientRect();
            createErrorParticles(rect.left + rect.width/2, rect.top + rect.height/2);
            anime({
                targets: password,
                translateY: [10, -10, 0],
                duration: 100,
                easing: 'easeInOutQuad'
            });
        }
    };

    // 视差效果
    window.addEventListener('mousemove', e => {
        const x = (e.clientX / window.innerWidth - 0.5) * 20;
        const y = (e.clientY / window.innerHeight - 0.5) * 20;
        anime({
            targets: '.login-container',
            rotateY: x,
            rotateX: -y,
            duration: 3000,
            easing: 'easeOutQuad'
        });
    });
</script>
</body>
</html>